package com.sa.stp.activities;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.sa.stp.R;

public class WebViewActivity extends Activity{

	
	private WebView mWebView;
	
	
	 public void onCreate(Bundle icicle) {
	        super.onCreate(icicle);
	        setContentView(R.layout.webview);
	 
	        //asociamos
	        mWebView = (WebView) findViewById(R.id.miwebview);
	        WebSettings miWebSettings =mWebView.getSettings();
	        miWebSettings.setSavePassword(false);
	        miWebSettings.setSaveFormData(false);
	        miWebSettings.setJavaScriptEnabled(true);
	        miWebSettings.setSupportZoom(true);
	        
	        mWebView.setWebChromeClient(new MyWebChromeClient());
	    
	        
	        
	 
	        //cargo un .html que he situado en la carpeta asset/ del proyecto
	        mWebView.loadUrl("http://dl.dropbox.com/u/3233636/tiempo.html");
	    }
	 
	 
	 
	 	 
	 /**
	  * "alerta" para javascript. Util para depurar javascript.
	  */
	 private final class MyWebChromeClient extends WebChromeClient {
	     @Override
	     public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
	         result.confirm();
	         return true;
	     }
	 }
}
